<template>
  <div id="collection-item">
    <div class="col-cover" @click="$router.push('/collection/' + colData.id)">
      <img :src="ipfsHash + colData.logo" alt="cover" v-if="colData.logo != null"/>
    </div>
    <div class="info">
      <!-- 小图标 -->
      <div
        class="col-cover-mini-box"
      >
        <div class="col-cover-mini" @click="$router.push('/user/'+colData.owner)">
          <img :src="colData.user_logo | ipfsHash"  v-if="colData.user_logo"/>
          <RandomAvatar :user_address="colData.owner" v-else/>
        </div>
      </div>
      <div class="col-info">
        <div class="col-name">{{colData.title}}</div>
        <div class="col-dec">
          {{colData.info}}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["colData"],
  data(){
    return{
      ipfsHash:"http://172.17.147.23:8888/ipfs/"
    }
  },
};
</script>

<style lang='less'>
#collection-item:hover {
  box-shadow: 0px 8px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.2s linear;
}
#collection-item {
  // height: 200px;
  transition: all 0.2s ease;
  padding-bottom: 20px;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: 0px 8px 10px rgba(0, 0, 0, 0.05);
  .col-cover {
    cursor: pointer;
    height: 200px;
    width: 100%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    img {
      border-radius: 10px;
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
  .info {
    // background: #fff;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    text-align: center;
    .col-info {
      margin-top: 20px;
      .col-name {
        color: #333;
        font-size: 18px;
        display: -webkit-box; /**对象作为伸缩盒子模型展示**/
        -webkit-box-orient: vertical; /**设置或检索伸缩盒子对象的子元素的排列方式**/
        -webkit-line-clamp: 1; /**显示的行数**/
        overflow: hidden; /**隐藏超出的内容**/
      }
      .col-dec {
        padding-top: 10px;
        font-size: 13px;
        line-height: 1.9em;
        width: 300px;
        margin: 0 auto;
        color: #333;
        display: -webkit-box; /**对象作为伸缩盒子模型展示**/
        -webkit-box-orient: vertical; /**设置或检索伸缩盒子对象的子元素的排列方式**/
        -webkit-line-clamp: 2; /**显示的行数**/
        overflow: hidden; /**隐藏超出的内容**/
      }
    }

    .col-cover-mini-box:hover {
      background: var(--themeColor1);
      transition: 0.3s ease;
    }
    .col-cover-mini-box {
      cursor: pointer;
      margin: 0 auto;
      margin-top: -30px;
      align-items: center;
      border-radius: 90px;
      background: #fff;
      color: #eee;
      .col-cover-mini {
        height: 40px;
        width: 40px;
        padding: 3px;
        img {
          border-radius: 50%;
          width: 100%;
          height: 100%;
          object-fit: cover;
        }
      }
   
    }
  }
}
</style>